﻿<cfscript>
/** 
* ORM ProgramSchemaAudit
* 
* @hint "Hibernate persistenter t_schema_audit. 培养方案修订情况统计" 
* 
*/ 

component 
	displayname="public.service.orm.senate.ProgramSchemaAudit" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="ProgramSchemaAudit" 
	table="t_schema_audit"
	{
	
	property type="string" name="Schema" column="shmchg_id" fieldtype="id" generator="assigned" hint="培养方案号";

	property type="string" name="Grade" column="grade" hint="年级";

	property type="numeric" name="NewCounts" column="change_add" hint="添加次数";
	property type="numeric" name="EditCounts" column="change_modify" hint="修改次数";
	property type="numeric" name="DeleteCounts" column="change_delete" hint="删除次数";
	
	property name="Subject" fieldtype="many-to-one" fkcolumn="sbj_id" cfc="Subject"  hint="专业";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Subject "专业（方向）"
	* @Grade "年级（培养方案版本）"
	*/
	public string function getID( required Subject, required string Grade ) output=false {

		var nextID = arguments.Grade & "." & left(arguments.Subject.getSubjectID(), 5);
		/* 
			主键生成规则 
			
			培养方案号10位 4位为年级 , 5位专业代码

			Unique: GRADE, SBJ_ID
		*/
		return nextID;
	}
	
}

</cfscript>